package Eyjafjalla.relic;

import Eyjafjalla.action.GainCloudEnergyAction;
import Eyjafjalla.action.VoidBirdAction;
import Eyjafjalla.helper.StringHelper;
import basemod.abstracts.CustomRelic;
import com.megacrit.cardcrawl.actions.common.RelicAboveCreatureAction;
import com.megacrit.cardcrawl.actions.utility.ExhaustToHandAction;
import com.megacrit.cardcrawl.actions.utility.UseCardAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.helpers.ImageMaster;
import com.megacrit.cardcrawl.relics.AbstractRelic;

public class VoidBird extends CustomRelic {

    public static final String ID = "eyjafjalla:VoidBird";

    public VoidBird(){
        super(ID, ImageMaster.loadImage(StringHelper.getRelicIMGPATH(ID,false)),ImageMaster.loadImage(StringHelper.getRelicIMGPATH(ID,true)),RelicTier.RARE,LandingSound.MAGICAL);
    }

    private boolean firstCard = true;

    @Override
    public void atTurnStart() {
        firstCard = true;
        this.beginLongPulse();
    }

    @Override
    public void onVictory() {
        this.stopPulse();
    }

    @Override
    public void onUseCard(AbstractCard targetCard, UseCardAction useCardAction) {
        if(firstCard){
            this.flash();
            this.addToTop(new VoidBirdAction(targetCard.type));
            this.addToTop(new RelicAboveCreatureAction(AbstractDungeon.player,this));
            firstCard = false;
            this.stopPulse();
        }
    }

    @Override
    public String getUpdatedDescription() {
        return DESCRIPTIONS[0];
    }

    @Override
    public AbstractRelic makeCopy() {
        return new VoidBird();
    }
}



